package com.lizheng.yunservice.travel.controller;

import com.lizheng.yunservice.common.domain.ApiRestResponse;
import com.lizheng.yunservice.common.domain.PageQuery;
import com.lizheng.yunservice.common.page.TableDataInfo;
import com.lizheng.yunservice.travel.doamin.VtpCultural;
import com.lizheng.yunservice.travel.doamin.VtpCulturalCategory;
import com.lizheng.yunservice.travel.doamin.bo.VtpCulturalQueryBoPageSearch;
import com.lizheng.yunservice.travel.doamin.vo.VtpCulturalVo;
import com.lizheng.yunservice.travel.doamin.vo.VtpCulturalVoPageSearch;
import com.lizheng.yunservice.travel.service.IVtpCulturalService;
import com.lizheng.yunservice.travel.service.IVtpCulturalServicePageSearch;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 文创信息
 *
 * @author lizheng
 * @date 2024-12-19
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/vtp/app/cultural")
public class VtpCulturalController {

    private final IVtpCulturalService culturalService;

    private final IVtpCulturalServicePageSearch culturalServicePage;

//    /**
//     * 文创信息分页列表
//     */
//    @GetMapping("/getCulturalList")
//    public TableDataInfo<VtpCulturalVo> getCulturalList(VtpCulturalBo bo, PageQuery pageQuery) {
//        return culturalService.queryPageList(bo, pageQuery);
//    }

    /**
     * 根据类别ID查询文创列表
     */
    @GetMapping("/getCulturalByCategory/{categoryId}")
    public ApiRestResponse<List<VtpCultural>> getCulturalByCategory(@PathVariable Long categoryId) {
        List<VtpCultural> list = culturalService.queryListByCategoryId(categoryId);
        return ApiRestResponse.ok(list);
    }

    /**
     * 查询所有文创类别
     */
    @GetMapping("/getAllCategories")
    public ApiRestResponse<List<VtpCulturalCategory>> getAllCategories() {
        List<VtpCulturalCategory> list = culturalService.queryAllCategories();
        return ApiRestResponse.ok(list);
    }

    /**
     * 分页查询
     */
    @PostMapping("/page")
    public ApiRestResponse<TableDataInfo<VtpCulturalVoPageSearch>> getCulturalPage(
            @RequestBody VtpCulturalQueryBoPageSearch queryBo) {
        return ApiRestResponse.ok(culturalServicePage.queryAppPageList(queryBo));
    }
} 